package data;

import anaydis.sort.data.DataSetGenerator;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: alumnosfi
 * Date: 17/01/2011
 * Time: 15:41:49
 * To change this template use File | Settings | File Templates.
 */
public class IntegerDataSetGenerator implements DataSetGenerator<Integer> {
    public List<Integer> createAscending(int i) {
        List<Integer> list = new ArrayList();
        for(int j=0; j<i; j++){
            list.add(j);
        }
        return list;
    }
    public List<Integer> createDescending(int i) {
        List<Integer> list = new ArrayList();
        for(int j=i-1; j>=0; j--){
            list.add(j);
        }
        return list;
    }
    public List<Integer> createRandom(int i) {
        List<Integer> list = new ArrayList();
        for(int j=0; j<i; j++){
            list.add((int)(Math.random()*i));
        }
        return list;
    }
    public Comparator getComparator() {
        return new Comparator<Integer>(){
            public int compare(Integer integer, Integer integer1) {
                return integer.compareTo(integer1);
            }
        };
    }
}
